<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app1" >
  <el-form ref="form" :model="sizeForm" label-width="80px" size="small">
    <el-form-item label="竞赛名称">
      <el-input v-model="sizeForm.raceName" ></el-input>
    </el-form-item>
    <el-form-item label="赛道名称">
      <el-select v-model="sizeForm.trackName" placeholder="请选择赛道">
        <el-option label="国家赛" value="guojiasai"></el-option>
        <el-option label="四川省赛" value="sichuanshengsai"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="竞赛阶段">
      <el-select v-model="sizeForm.raceStep" placeholder="请选择竞赛阶段">
        <el-option label="初赛" value="chusai"></el-option>
        <el-option label="复赛" value="fusai"></el-option>
        <el-option label="决赛" value="juesai"></el-option>
      </el-select>
    </el-form-item>
<!--    <el-form-item label="竞赛阶段">-->
<!--      <el-checkbox-group v-model="raceStep">-->
<!--        <el-checkbox-button label="初赛" name="type"></el-checkbox-button>-->
<!--        <el-checkbox-button label="复赛" name="type"></el-checkbox-button>-->
<!--        <el-checkbox-button label="决赛" name="type"></el-checkbox-button>-->
<!--      </el-checkbox-group>-->
<!--    </el-form-item>-->
    <el-form-item label="参赛学生">
    <el-input  v-model="sizeForm.studentName" placeholder="请输入姓名"></el-input>
    </el-form-item>
    <el-form-item label="老师姓名">
      <el-input  v-model="sizeForm.teacherName" placeholder="请输入老师姓名"></el-input>
    </el-form-item>
    <el-form-item label="获奖时间">
      <el-col :span="11">
        <el-date-picker type="date" placeholder="选择日期" v-model="sizeForm.winDate" style="width: 100%;"></el-date-picker>
      </el-col>
      <el-col class="line" :span="2"></el-col>
    </el-form-item>
<!--    <el-form-item label="奖励等次">-->
<!--      <el-checkbox-group v-model="sizeForm.level">-->
<!--        <el-checkbox-button label="一等奖" name="type"></el-checkbox-button>-->
<!--        <el-checkbox-button label="二等奖" name="type"></el-checkbox-button>-->
<!--        <el-checkbox-button label="三等奖" name="type"></el-checkbox-button>-->
<!--      </el-checkbox-group>-->
<!--    </el-form-item>-->
    <el-form-item label="奖励等次">
      <el-select v-model="sizeForm.level" placeholder="请选择奖励等次">
        <el-option label="一等奖" value="first"></el-option>
        <el-option label="二等奖" value="secend"></el-option>
        <el-option label="三等奖" value="third"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="奖状上传">
      <el-upload
              class="upload-demo"
              drag
              action="http://localhost:8080/upload"
              multiple>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>
      </el-upload>
    </el-form-item>
    <el-form-item size="large">
      <el-button type="primary" @click="onSubmit">立即创建</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="js/axios-0.18.0.js"></script>
<script>
  new Vue({
    el: '#app1',
    data() {
      return {
        sizeForm: {
          raceName: '',
          trackName: '',
          raceStep:'',
          studentName: '',
          teacherName: '',
          winDate: '',
          level:'',
         cert: ''
        }
      };
    },
    methods: {
      onSubmit() {
        console.log('submit!');
        var _this = this;
        axios({
          method:"post",
          url:"http://localhost:8080/student",
          data:_this.sizeForm
        }).then(
                window.location.href = '/result.html'
        )
      }
    }
  })
</script>
</html>